package com.hysf.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class AspectEmail {
	@Pointcut("execution(* com.hysf.service.impl.BankBizImpl.transfer(..))")
	public void transfer() {
	}
	
	@Pointcut("execution(* com.hysf.service.impl.BankBizImpl.deposite(..))")
	public void deposite() {
	}
	
	@Pointcut("execution(* com.hysf.service.impl.BankBizImpl.withdraw(..))")
	public void withdraw() {
	}
	
	@AfterReturning(pointcut = "transfer() || deposite() || withdraw()", returning = "account")
	public void sendEmail(JoinPoint joinPoint, Object account) {
		System.out.println("---------------------AspectEmail----------------------");
		System.out.println("转账成功，发送邮件" + account);
		System.out.println("目标方法" + joinPoint.getSignature().getName());
		System.out.println("目标方法参数" + joinPoint.getArgs());
		System.out.println("---------------------AspectEmail----------------------");
	}
}
